<template>
  <div class="title">
    <img class="bg-img" src="../assets/screen/title.png" alt="">
    <div class="container flex-row">
      <div class="title-val flex1">
        {{ name }}
      </div>
      <i v-if="switchBtn" class="el-icon-refresh title-val" @click="$emit('switch')" :title="`切换到${viewMode === 1 ? '站点' : '城市'}排名`"></i>
    </div>
  </div>
</template>
<script>
export default {
  name: 'subtitle',
  props: {
    name: {
      type: String
    },
    switchBtn: {
      type: Boolean
    },
    viewMode: {
      type: Number
    }
  }
}
</script>
<style scoped lang="scss">
.title {
  width: 100%;
  height: 32px;
  position: relative;
  .bg-img {
    width: 100%;
    position: absolute;
    opacity: 0.8;
    z-index: 0;
  }
  .container {
    width: 67%;
    position: relative;
    z-index: 1;
    .title-val {
      font-size: 16px;
      line-height: 32px;
      text-indent: 1em;
      text-transform: uppercase;
      display: inline-block;
      font-weight: bold;
      color: #ffffff;
    }
    .el-icon-refresh {
      margin-right: 5px;
      cursor: pointer;
      text-align: center;
      text-indent: 0;
    }
  }
}
</style>